<template>
  <div class="box_content">
    <!-- :autoplay="false" -->
    <el-carousel
      height="0.1458rem"
      class="f2_content_list_carousel"
      arrow="always"
      :interval="3000"
    >
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot1" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot2" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot3" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot4" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot5" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot6" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot7" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot8" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="f2_content_list" v-for="item in hot9" :key="item.id">
          <p>{{ item.entname }}</p>
        </div>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import { myPostFetch } from '@/utils'
export default {
  data() {
    return {
      hot: null,
      hot1: null,
      hot2: null,
      hot3: null,
      hot4: null,
      hot5: null,
      hot6: null,
      hot7: null,
      hot8: null,
      hot9: null
    }
  },
  mounted() {
    this.hots()
  },
  methods: {
    // 最热承兑人
    async hots() {
      let hot = []
      let hot1 = []
      let hot2 = []
      let hot3 = []
      let hot4 = []
      let hot5 = []
      let hot6 = []
      let hot7 = []
      let hot8 = []
      let hot9 = []
      let url = '/api/BusinessSPs/getHotAndNew'
      let params = {}
      let data = await myPostFetch(url, params)
      if (data.data == null) return
      for (let i = 0; i < data.data.news.length; i++) {
        if (i >= 0 && i < 5) {
          hot.push(data.data.news[i])
        }
        if (i >= 5 && i < 10) {
          hot1.push(data.data.news[i])
        }
        if (i >= 10 && i < 15) {
          hot2.push(data.data.news[i])
        }
        if (i >= 15 && i < 20) {
          hot3.push(data.data.news[i])
        }
        if (i >= 20 && i < 25) {
          hot4.push(data.data.news[i])
        }
        if (i >= 25 && i < 30) {
          hot5.push(data.data.news[i])
        }
        if (i >= 30 && i < 35) {
          hot6.push(data.data.news[i])
        }
        if (i >= 35 && i < 40) {
          hot7.push(data.data.news[i])
        }
        if (i >= 40 && i < 45) {
          hot8.push(data.data.news[i])
        }
        if (i >= 45 && i < 50) {
          hot9.push(data.data.news[i])
        }
      }
      this.hot = hot
      this.hot1 = hot1
      this.hot2 = hot2
      this.hot3 = hot3
      this.hot4 = hot4
      this.hot5 = hot5
      this.hot6 = hot6
      this.hot7 = hot7
      this.hot8 = hot8
      this.hot9 = hot9
    }
  }
}
</script>

<style lang="scss" scoped>
.box_content {
  display: flex;
  align-items: center;
  height: 100%;
}
.f2_content_list {
  box-sizing: border-box;
  padding: 0.0208rem 0.0521rem;
  display: flex;
  align-items: center;
  width: 1.3542rem;
  margin-right: 0.1563rem;
  background: #dce4f8;
  p {
    width: 1.3542rem;
    font-size: 0.0833rem;
    font-weight: 400;
    color: #333333;
    text-align: center;
    white-space: nowrap; /* 禁止文本换行 */
    overflow: hidden; /* 隐藏溢出的部分 */
    text-overflow: ellipsis; /* 显示省略号 */
  }
}
::v-deep .el-carousel {
  width: 10rem;
  height: 0.1563rem !important;
  position: relative;
}
::v-deep .el-carousel__arrow--left {
  display: none;
}
::v-deep .el-carousel__indicator--horizontal {
  display: none;
}
::v-deep .el-carousel__item {
  display: flex;
}
</style>
